<?php
/*
 * [JINYUN!] (C)2001-2099 Jinyunweb.com
 * This is NOT a freeware, use is subject to license terms
 *留言记录
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'edit';
if($_RQ['op']=='edit'){
	$item=pdo_get('jy_51job_jianli',array('mid'=>$_SESSION['uid'],'uniacid'=>$_SESSION['uniacid']));
	$item['gonginfo']=$item['gonginfo']?json_decode($item['gonginfo'],true):array();
	$item['xueinfo']=$item['xueinfo']?json_decode($item['xueinfo'],true):array();
	$item['xianginfo']=$item['xianginfo']?json_decode($item['xianginfo'],true):array();
	$item['peiinfo']=$item['peiinfo']?json_decode($item['peiinfo'],true):array();
	$item['pcd']=$item['pcd']?json_decode($item['pcd'],true):array('city'=>'');
	$return['item']=$item;
	$return['groups']=pdo_getall('jy_51job_job_group',array('pid'=>0,'uniacid'=>$_SESSION['uniacid']),array('id','title'),'id');
	foreach($return['groups'] as &$pv){
		$pv['cids']=pdo_getall('jy_51job_job_group',array('pid'=>$pv['id'],'uniacid'=>$_SESSION['uniacid']),array('id','title'),'id');
	}
	$return['job_type']=$this->job_type;
	$return['xinzhis']=$this->xinzhis;
	$return['xinzhis2']=$this->xinzhis2;
	$return['xueli_type']=$this->xueli_type;
	set_html('title','我的简历');
	exi($return);
}
if($_RQ['op']=='post'){
	$postdata=get_postdata();
	if(!$postdata['name'] || !$postdata['title'] || !$postdata['sex'] || !$postdata['xueli'] || !$postdata['mobile']){
		exi('姓名称呼，意向职位，性别，学历，手机必填！','error');
	}
	$member=pdo_get('jy_51job_member',array('id'=>$_SESSION['memberid'],'uniacid'=>$_SESSION['uniacid']));
	$sousuo=$postdata['title'].'|'.$member['nickname'].'|'.$member['usename'].'|'.$member['realname'].'|'.$member['yixiang'].'|'.$member['pingjia'].'|'.$member['jiinfo'].'|'.ijson_encode($postdata['gonginfo']).'|'.ijson_encode($postdata['xueinfo']).'|'.ijson_encode($postdata['xianginfo']).'|'.ijson_encode($postdata['peiinfo']).'|'.ijson_encode($postdata['pcd']);
	$data=array(
			'title'=>trim($postdata['title']),
			'price'=>trim($postdata['price']),
			'name'=>trim($postdata['name']),
			'age'=>trim($postdata['age']),
			'education'=>trim($postdata['education']),
			'xueli'=>$postdata['xueli'],
			'express'=>trim($postdata['express']),
			'type'=>$postdata['type'],
			'mobile'=>trim($postdata['mobile']),
			'sex'=>trim($postdata['sex']),
			'address'=>trim($postdata['address']),
			'email'=>trim($postdata['email']),
			'currentstatus'=>trim($postdata['currentstatus']),
			'content'=>trim($postdata['content']),
			'pid'=>trim($postdata['pid']),
			'city'=>$postdata['pcd']['city'],
			'district'=>$postdata['pcd']['district'],
			'pcd'=>ijson_encode($postdata['pcd']),
			'status'=>trim($postdata['status']),
			'sousuo'=>trim($sousuo),
	);
	$id=intval($postdata['id']);
	if($id){
		pdo_update('jy_51job_jianli',$data,array('id'=>$id,'uniacid'=>$_SESSION['uniacid']));
	}else{
		$data['uniacid']=$_SESSION['uniacid'];
		$data['mid']=$_SESSION['uid'];
		$data['createtime']=time();
		pdo_insert('jy_51job_jianli',$data);
	}
	exi('操作成功！','','/home/');
}
